<?php
include_once("../config/config.inc.php");
include_once("head.php");
include_once("common.php");

$submit = isset($HTTP_GET_VARS['submit']) ? $HTTP_GET_VARS['submit'] :
	(isset($HTTP_POST_VARS['submit']) ? $HTTP_POST_VARS['submit'] :
	$HTTP_COOKIE_VARS['submit']);
$formdata =isset($HTTP_POST_FILES['formdata']['name'])?$HTTP_POST_FILES['formdata']['name']:
	(isset($_FILES['formdata']['name'])?$_FILES['formdata']['name']:
	$formdata);
$formdata_name =isset($HTTP_POST_FILES['formdata']['name'])?$HTTP_POST_FILES['formdata']['name']:
	(isset($_FILES['formdata']['name'])?$_FILES['formdata']['name']:
	$formdata_name);
$formdata_size =isset($HTTP_POST_FILES['formdata']['size'])?$HTTP_POST_FILES['formdata']['size']:
	(isset($_FILES['formdata']['size'])?$_FILES['formdata']['size']:
	$formdata_size);
$formdata_type =isset($HTTP_POST_FILES['formdata']['type'])?$HTTP_POST_FILES['formdata']['type']:
	(isset($_FILES['formdata']['type'])?$_FILES['formdata']['type']:
	$formdata_type);
?>
<?php
if($submit!="OK")
{

?>
<form action=<?php echo $PHP_SELF; ?> method=post enctype="multipart/form-data">
<input type=hidden name=MAX_FILE_SIZE value="2000000">
<input type=file name=formdata value="">
<input type="submit" name="submit" value="OK">
</form>
<?php
}
echo $formdata,$formdata_type;

//if(copy($formdata),"abc.a")){}else{echo "No";}
if (is_uploaded_file($_FILES['formdata']['tmp_name']))
	{
  	  copy($_FILES['formdata']['tmp_name'], "abc.abc");
	} else {
   	 echo "Possible file upload attack. Filename: " . $_FILES['userfile']['name'];
	}
//move_uploaded_file($_FILES['formdata']['tmp_name'], "abc.abc");
?>
</body>
</html>